package com.tgy.thread;

import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.LockSupport;

/**
 * @Author: tgy
 * @Date: 12/1/20 4:47 PM
 */
public class InterruptDemo {

    public static void main(String[] args) throws Exception {

        Thread t1 = new Thread(() -> {

            LockSupport.park();
            System.out.println("111");
            System.out.println(Thread.currentThread().isInterrupted());
            System.out.println("222");
            LockSupport.park();

        }, "t1");

        t1.start();
        TimeUnit.SECONDS.sleep(2);

        t1.interrupt();
//        LockSupport.unpark(t1);

        t1.join();
    }
}
